import 'item_style.dart';

import 'package:json_annotation/json_annotation.dart';

part 'geo.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class ScaleLimit {
  var min;
  var max;

  ScaleLimit({this.min, this.max});

  factory ScaleLimit.fromJson(Map<String, dynamic> json) =>
      _$ScaleLimitFromJson(json);

  Map<String, dynamic> toJson() => _$ScaleLimitToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class GEOLabel {
  var show;
  var position;
  var distance;
  var rotate;
  var offset;
  var formatter;

  var color;
  var fontStyle;
  var fontWeight;
  var fontFamily;
  var fontSize;
  var align;
  var verticalAlign;
  var lineHeight;
  var backgroundColor;
  var borderColor;
  var borderWidth;
  var borderType;
  var borderDashOffset;

  var borderRadius;
  var padding;
  var shadowColor;
  var shadowOffsetX;
  var shadowOffsetY;
  var width;
  var height;

  var textBorderColor;
  var textBorderWidth;
  var textBorderType;
  var textBorderDashOffset;

  var textShadowColor;
  var textShadowBlur;
  var textShadowOffsetX;
  var textShadowOffsetY;
  var overFlow;
  var ellipsis;
  var lineOverflow;
  var rich;

  GEOLabel(
      this.show,
      this.position,
      this.distance,
      this.rotate,
      this.offset,
      this.formatter,
      this.color,
      this.fontStyle,
      this.fontWeight,
      this.fontFamily,
      this.fontSize,
      this.align,
      this.verticalAlign,
      this.lineHeight,
      this.backgroundColor,
      this.borderColor,
      this.borderWidth,
      this.borderType,
      this.borderDashOffset,
      this.borderRadius,
      this.padding,
      this.shadowColor,
      this.shadowOffsetX,
      this.shadowOffsetY,
      this.width,
      this.height,
      this.textBorderColor,
      this.textBorderWidth,
      this.textBorderType,
      this.textBorderDashOffset,
      this.textShadowColor,
      this.textShadowBlur,
      this.textShadowOffsetX,
      this.textShadowOffsetY,
      this.overFlow,
      this.ellipsis,
      this.lineOverflow,
      this.rich);

  factory GEOLabel.fromJson(Map<String, dynamic> json) =>
      _$GEOLabelFromJson(json);

  Map<String, dynamic> toJson() => _$GEOLabelToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class GEOEmphasis {
  GEOLabel? label;
  ItemStyle? itemStyle;

  GEOEmphasis({this.label, this.itemStyle});

  factory GEOEmphasis.fromJson(Map<String, dynamic> json) =>
      _$GEOEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$GEOEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class Region {
  var name;
  var selected;
  ItemStyle? itemStyle;
  GEOLabel? label;
  GEOEmphasis? emphasis;
  GEOEmphasis? select;

  Region(
      {this.name,
      this.selected,
      this.itemStyle,
      this.label,
      this.emphasis,
      this.select});

  factory Region.fromJson(Map<String, dynamic> json) => _$RegionFromJson(json);

  Map<String, dynamic> toJson() => _$RegionToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class Geo {
  var id;
  var show;
  var map;
  var roam;
  var center;
  var aspectScale;
  var boundingCoords;
  var zoom;
  ScaleLimit? scaleLimit;
  var nameMap;
  var nameProperty;
  var selectedMode;
  GEOLabel? label;
  ItemStyle? itemStyle;
  GEOEmphasis? emphasis;
  GEOEmphasis? select;

  var zlvel;
  var z;

  var left;
  var top;
  var right;
  var bottom;
  var layoutCenter;
  var layoutSize;

  List<Region>? regions;
  var silent;

  Geo(
      {this.id,
      this.show,
      this.map,
      this.roam,
      this.center,
      this.aspectScale,
      this.boundingCoords,
      this.zoom,
      this.scaleLimit,
      this.nameMap,
      this.nameProperty,
      this.selectedMode,
      this.label,
      this.itemStyle,
      this.emphasis,
      this.select,
      this.zlvel,
      this.z,
      this.left,
      this.top,
      this.right,
      this.bottom,
      this.layoutCenter,
      this.layoutSize,
      this.regions,
      this.silent});

  factory Geo.fromJson(Map<String, dynamic> json) => _$GeoFromJson(json);

  Map<String, dynamic> toJson() => _$GeoToJson(this);
}
